#ifndef COMMAND_H
#define COMMAND_H

#include <QVariant>
#include <QVector>

/*
 * This class collects information about the command to execute
 */
class Command
{
public:
    enum Type {
        NOP, // do nothing
        ASSIGN, // assign to property
        IDASSIGN, // assign object id *special*
        OBJECT, // a reminder that object was created
        IMPORT, // load a library or script
        ROOTOBJ // register root object
    };

    Command(Type type = Command::NOP);
    Command(const Command &other);

    void setArgs(int capacity, const QVariant *arg, ...);
    const QVector<QVariant>& args() const;

    Type type() const;
private:
    Type mType;
    QVector<QVariant> mArgs; // operands
};


typedef QVector<Command> Commands;

/*
 * This is used for QVariant types and macros:
 * Command c;
 * QVariant v = QVariant::fromValue(c);
 */
Q_DECLARE_METATYPE(Command)
Q_DECLARE_METATYPE(Commands)

#endif // COMMAND_H
